package com.studentms.web;

import com.studentms.bean.Grade;
import com.studentms.service.GradeService;
import com.studentms.service.impl.GradeServiceImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

@WebServlet(urlPatterns = "/Educational/student/getGradeList")
public class GradeListServlet extends HttpServlet {

    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
       //查询年级列表的方法

        //1.接收参数

        //2.获取service
        GradeService service = new GradeServiceImpl();
        List<Grade> list = service.getList();//返回list集合
        req.setAttribute("glist",list);//存值
        //转发方式跳转页面
        req.getRequestDispatcher("add.jsp").forward(req,resp);
    }
}
